﻿var app = angular.module('churchapp', ['ui.bootstrap', 'AxelSoft']);
app.run(function($rootScope) {
    $rootScope.dateformet = "dd/mm/yy";
})

app.directive('calendarwithtextalso', function ($rootScope) {
    return {
        require: 'ngModel',
        link: function (scope, el, attr, ngModel) {
            $(el).datepicker({
                dateFormat: $rootScope.dateformet,
                onSelect: function (dateText) {
                    scope.$apply(function () {
                        ngModel.$setViewValue(dateText);
                    });
                },
                constrainInput:false,
                changeMonth: true,
                changeYear: true
            });
        }
    };
})

function getQueryString(param, dummyPath) {
    var sPageURL = dummyPath || window.location.search.substring(1),
        sURLVariables = sPageURL.split(/[&||?]/),
        res;
    for (var i = 0; i < sURLVariables.length; i += 1) {
        var paramName = sURLVariables[i],
            sParameterName = (paramName || '').split('=');

        if (sParameterName[0] === param) {
            res = sParameterName[1];
        }
    }
    return res;
}
